<template>
  <div>
    <detail-header></detail-header>
    <detail-banner :imgs="gallaryImgs"></detail-banner>
    <detail-price></detail-price>
    <detail-list :list="list"></detail-list>
    <detail-description></detail-description>
  </div>
</template>

<script>
import DetailBanner from './components/Banner'
import DetailHeader from './components/Header'
import DetailPrice from './components/Price'
import DetailList from './components/List'
import DetailDescription from './components/Description'
import axios from 'axios'
export default {
  name: 'Detail',
  components: {
    DetailHeader,
    DetailBanner,
    DetailPrice,
    DetailList,
    DetailDescription
  },
  data () {
    return {
      bannerImg: '',
      gallaryImgs: [],
      list: []
    }
  },
  methods: {
    getDetailInfo () {
      axios.get('/api/detail.json', {
        params: {
          id: this.$route.params.id
        }
      }).then(res => {
        if (res.status === 200) {
          let result = res.data.data
          console.log(result)
          this.bannerImg = result.bannerImg
          this.gallaryImgs = result.gallaryImgs
          this.list = result.categoryList
        } else {
        }
      })
    }
  },
  activated () {
    this.getDetailInfo()
  }
}
</script>

<style lang="stylus" scoped>

</style>
